<style lang="scss">
	page{
		background: #F5F5F5;
		// padding-top: 30upx;
		.all{
			width: 750upx;
			.list{
				width: 690upx;
				padding: 30upx;
				background: #FFFFFF;
				display: flex;
				margin-top: 4upx;
				.box{
					width: 168upx;
					height: 44upx;
					font-size: 32upx;
					font-weight: 400;
					color: #000000;
					line-height: 44upx;
				}
				.money{
					width: 450upx;
					height: 48upx;
					font-size: 34upx;
					font-weight: 400;
					color: #333333;
					line-height: 48upx;
					margin-left: 36upx;
				}
				.status{
					width: 484upx;
					text-align: right;
					height: 42upx;
					font-size: 30upx;
					font-weight: 400;
					color: #A02731;
					line-height: 42upx;
				}
				.image{
					width: 22upx;
					height: 32upx;
					margin-top: 8upx;
					margin-left: 24upx;
				}
			}
			.anniu{
				width: 690upx;
				height: 90upx;
				background: #A02731;
				border-radius: 10upx;
				margin-top: 112upx;
				margin-left: 30upx;
				text-align: center;
				line-height: 90upx;
				color: #FFFFFF;
				font-size: 32upx;
			}
			.text{
				width: 690upx;
				padding: 30upx;
				margin-top: 10upx;
				font-size: 28upx;
				font-weight: 400;
				color: #999999;
				line-height: 40upx;
			}
		}
	}
</style>
<template>
	<view class="all">
		<view class="list">
			<view class="box">提现金额:</view>
			<input :value="money" placeholder="请输入提现金额" type="number" @input="money_input" class="money" style="border-bottom: 1upx solid #eee;" />
		</view>
		<view class="anniu" @click="withdraw_tap">一键提现</view>
		<view class="text">
			<view class="text_name">提示：最少提现100元,或100元的倍数。</view>
			<view class="text_name">正常用户发起提现后次日到账，遇到节假日顺延，平台将 按照提现佣金{{text}}%收取手续费。我们将把您的提现金额打到您平台签约账号上。</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				money:'',
				list:'',
				text:''
			}
		},
		onLoad(num) {
		},
		onShow() {
			this.user_withdraws_api()
		},
		methods: {
			money_input(num) {
				this.money = num.detail.value
			},
			//获取首页
			withdraw_tap() {
				var that = this
				if(Number(that.money) >= 100 ) {
					var re = /^[0-9]*[0-9]$/i; //校验是否为数字
						if(re.test(Number(that.money)) && Number(that.money)%100===0) {
							// return true;
							that.user_withdraw_api()
						}else {
							// return false;
							uni.showToast({
								title: '提示：最少提现100元,或100元的倍数。',
								duration: 2000,
								icon: 'none'
							});
					}
					// 
				}else{
					uni.showToast({
						title: '提示：最少提现100元,或100元的倍数。',
						duration: 2000,
						icon: 'none'
					});
				}
			},
			user_withdraw_api() {
				var that = this
				that.$request(that.$Api.user_withdraw_api, {
					access_token: uni.getStorageSync('access_token'),
					money:that.money,
				}, "POST").then(res => {
					if (res.data.code == 0) {
						uni.showToast({
							title: res.data.msg,
							duration: 2000,
							icon: 'none'
						});
						setTimeout(function () {
						    uni.navigateBack({
						    	delta:1
						    })
						}, 2000);
					} else {
						uni.showToast({
							title: res.data.msg,
							duration: 2000,
							icon: 'none'
						});
					}
				})
			},
			user_withdraws_api() {
				var that = this
				that.$request(that.$Api.user_withdraws_api, {
					access_token: uni.getStorageSync('access_token'),
				}, "POST").then(res => {
					if (res.data.code == 0) {
						that.text = res.data.data.text
					} else {
						uni.showToast({
							title: res.data.msg,
							duration: 2000,
							icon: 'none'
						});
					}
				})
			},
		}
	}
</script>



















